package com.hj.aimin.auth.common;

import lombok.Data;

@Data
public class Result<T> implements java.io.Serializable {
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    private T data;


    public static final int SUCCESS_CODE = 200;
    public static final int ERROR_CODE = 500;
    public static final String SUCCESS_MSG = "操作成功";

   public static  <T> Result<T> success(T data){
       Result<T> result = new Result<>();
       result.setCode(SUCCESS_CODE);
       result.setMsg(SUCCESS_MSG);
       result.setData(data);
       return result;
   }

   public static  <T> Result<T> error(int code,String msg){
       Result<T> result = new Result<>();
       result.setCode(code);
       result.setMsg(msg);
       return result;
   }

}
